#!/bin/bash

# ----------------------------------------------------------------------
# Filename:   75638-stat.sh
# Version:    1.0
# Date:       2013/12/18
# Author:     yuanhui.shi
# Email:      yuanhui.shi@cs2c.com.cn
# Summary:    03系统安全功能-01SELinux-03SELinux重要命令-03SELinux安全上下文标签相关命令-02stat
# Notes:      安全上下文标签 stat
# Copyright:  China Standard Software Co., Ltd.
# History：     
#             Version 1.0, 2013/12/18
#             -   The first one
# ----------------------------------------------------------------------

PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH

source ../../lib/Echo.sh
source ../../lib/XmlParse.sh
source ./lib/Selib.sh

function CleanData ()
{
  rm -rf /tmp/test 
  EchoInfo "75638-stat.sh执行完毕"
}

trap "CleanData" EXIT
CheckSElinuxStatus

mkdir /tmp/test
touch /tmp/test/file1


EchoInfo "stat -Z///stat --context：均显示文件名称、文件规模信息、文件设备信息，文件属性信息，文件时间信息，文件访问权限信息，文件安全上下文等，检验执行结果是否正确"
[ "`stat -Z /tmp/test/file1|wc -l`" == "8" ] && [ "`stat --context /tmp/test/file1|wc -l`" == "8" ]
EchoResult "stat -Z与stat --context命令执行结果正确"

